package dao;

import java.util.List;

import Bean.memberBean;

import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;

public class memberDao extends SqlMapClientDaoSupport {
	/* 멤버입력 */
	public void insert(memberBean mBean) {
		getSqlMapClientTemplate().insert("mInsert", mBean);
	}
	public memberBean getIdInfo(String mid){
		//아이디를 이용하여 특정 회원 1사람에 대한 정보를 빈으로 조회하기
		memberBean member = (memberBean)getSqlMapClientTemplate().queryForObject("getmid", mid);
		return member;
	}

	public int mCheckid(String mid, String mpassword) {

		memberBean member = (memberBean)getSqlMapClientTemplate().queryForObject("getmid", mid);
		String pw="";
		pw = mpassword;
		if (member!=null) {
			if (pw.equals(member.getMpassword())) {
				return 1;
			} else {
				return 0;
			}
		} else {
			return -1;
		}
	}

	/* 멤버 한명 검색 */
	public memberBean mSelect(String string) {
		memberBean member = (memberBean) getSqlMapClientTemplate().queryForObject("mSelect", string);

		return member;
	}
	
	/* 멤버 수정 */
	public void update(memberBean mBean) {
		getSqlMapClientTemplate().update("mUpdate", mBean);
	}
	
	public void delete(Integer mnum) {
		getSqlMapClientTemplate().update("mDelete", mnum);		
	}
	
	public memberBean mFindId(memberBean bean) {
		memberBean member = (memberBean)getSqlMapClientTemplate().queryForObject("mFindId", bean);
		return member;
	}
	
	public memberBean mFindPw(memberBean bean) {
		memberBean member = (memberBean)getSqlMapClientTemplate().queryForObject("mFindId", bean);
		return member;
	}
	public List<?> getTotalCount(memberBean bean) {
		List<?> result = getSqlMapClientTemplate().queryForList("AdmingetTotalCount", bean);
		return result;
	}
	public List<?> AdminSearch(memberBean bean) {
		List<?> result = getSqlMapClientTemplate().queryForList("AdmingetMemberInfo", bean);
		return result;
	}
	public List<?> Admindetail(memberBean bean) {
		List<?> result = getSqlMapClientTemplate().queryForList("AdminDetail", bean);
		return result;
	}
	public void Adminupdate(memberBean bean) {
		getSqlMapClientTemplate().update("Adminupdate", bean);
	}
	public void Admindelete(memberBean bean) {
		getSqlMapClientTemplate().delete("Admindelete", bean);
	}
}
